package com.matt.foundation.ext.sms.impl;

import com.matt.foundation.ext.sms.SendSmsService;
import com.matt.foundation.utils.HttpClientUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.io.IOException;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/11/10
 * *******************************
 */
@Service
@Slf4j
public class SendSmsServiceImpl implements SendSmsService {
    public static final String ACCESS_ID_KEY = "aliAccessId";
    public static final String ACCESS_KEY_KEY = "aliAccessKey";
    public static final String MNS_END_POINT_KEY = "smsEndpoint";

    @Override
    public void sendSms(String[] phones, String code, String templateCode) {

        for (String phone:phones){
            try {
                HttpClientUtil.sendGet(String.format("https://sms.mattbaby.com/api/v1/phoneCode?phone=%s&key=123456&code=%s", phone, code));
                log.info("发送成功:[{}] ",code);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
